package com.yitiao.mq;

import com.yitiao.producer.MessageCallback;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class EpcMessageCallback implements MessageCallback {

    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
//        byte[] body = correlationData.getReturnedMessage().getBody();
        String strBody = new String("body");
        if (ack){
            log.info("send success[{}]",strBody);
        }else {
            log.info("send fail[{}]",strBody);
        }
    }

    @Override
    public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {

    }
}
